﻿using System.Drawing;
using CanvasControl.View;
using GraphDrawing.Graph.Behaviors;

namespace GraphDrawing.Graph.View
{
    /// <summary>
    /// Представление для отрисовки рамки выделения.
    /// </summary>
    public class SelectionBoxView : ISelectionBoxView
    {
        readonly Appearance appearance;

        public SelectionBoxView(Appearance appearance)
        {
            this.appearance = appearance;
        }

        public void Draw(DrawingContext dc, Rectangle rect)
        {
            using (var brush = appearance.CreateBrush())
                dc.Graphics.FillRectangle(brush, rect);
            using (var pen = appearance.Border.CreatePen())
                dc.Graphics.DrawRectangle(pen, rect);
        }
    }
}